/**
 * 数据库连接
 */

const { Sequelize } = require('sequelize')
const { database } = require('@config')
const {
  host,
  port,
  dbName,
  username,
  password
} = database

const sequelize = new Sequelize(dbName, username, password, {
  host,
  port,
  dialect: 'mysql',
  timezone: '+08:00',
  logging: false,
  define: {
    timestamps: true,
    underscored: true
  }
})

sequelize.sync({
  // force: true
})

module.exports = {
  sequelize
}